#include <QtDeclarative/QDeclarativeView>
#include <QtGui/QApplication>
#include <QtGui/QDesktopWidget>
#include <QGraphicsObject>
#ifndef QT_NO_OPENGL
#include <QGLWidget>
#endif

int main(int argc, char* argv[])
{
    QApplication a(argc, argv);

    QDeclarativeView view;
    #ifndef QT_NO_OPENGL
    // Use QGLWidget to get the OpenGL support if available
    QGLFormat format = QGLFormat::defaultFormat();
    format.setSampleBuffers(false);

    QGLWidget *glWidget = new QGLWidget(format);
    glWidget->setAutoFillBackground(false);
    view.setViewport(glWidget);  // ownership of glWidget is taken
    #endif
    view.setSource(QUrl("qrc:/qml/BetaLabsClientQtQuick.qml"));
    view.setResizeMode(QDeclarativeView::SizeRootObjectToView);

    QObject::connect((QObject*)view.engine(), SIGNAL(quit()),
                     &a, SLOT(quit()));

    // Ensure that the size of the view is calculated correctly.
    view.setGeometry(QApplication::desktop()->screenGeometry());
    view.showFullScreen();

    return a.exec();
}
